<!DOCTYPE html>
<html>
<head>
    <title>API</title>

    <link href="../../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../../styles/kendo.default.min.css" rel="stylesheet">

    <script src="../../../js/jquery.min.js"></script>
    <script src="../../../js/kendo.web.min.js"></script>
    <script src="../../content/shared/js/console.js"></script>
</head>
<body>
    <a class="offline-button" href="../index.html">Back</a>
    
        <div id="example" class="k-content">
            <div class="configuration k-widget k-header" style="z-index:10000">
                <span class="configHead">API Functions</span>
                <ul class="options">
                    <li>
                        The pane index: <input id="index" type="text" value="0" class="k-textbox" style="margin-top: -5px;" />
                    </li>
                    <li>Functions:</li>
                    <li>
                         <button id="toggle" class="k-button">Expand/Collapse</button>
                    </li>
                    <li>
                        <input id="size" type="text" value="100px" class="k-textbox" /> <button id="setSize" class="k-button">Set size</button>
                    </li>
                    <li>
                        <input id="min" type="text" value="50px" class="k-textbox" /> <button id="setMinSize" class="k-button">Set minimum size</button>
                    </li>
                    <li>
                        <input id="max" type="text" value="150px" class="k-textbox" /> <button id="setMaxSize" class="k-button">Set maximum size</button>
                    </li>
                </ul>
            </div>

            <div id="splitter" style="height: 300px; width: 72%;">
                <div id="top_pane">
                    <p>
                        Left pane
                    </p>
                </div>
                <div id="ajax_pane">
                    <!-- content loaded with ajax -->
                </div>
                <div id="bottom_pane">
                    <p>
                        Right pane
                    </p>
                </div>
            </div>

            <script>
                $(document).ready(function() {
                    var panes = $("#splitter").children(),
                        getPane = function (index) {
                            index = Number(index);

                            if(!isNaN(index) && index < panes.length) {
                                return panes[index];
                            }
                        },
                        setSize = function (e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode) {
                                var pane = getPane($("#index").val());

                                if (!pane) return;

                                splitter.size(pane, $("#size").val());
                            }
                        },
                        setMinSize = function (e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode) {
                                var pane = getPane($("#index").val());

                                if (!pane) return;

                                splitter.min(pane, $("#min").val());
                            }
                        },
                        setMaxSize = function (e) {
                            if (e.type != "keypress" || kendo.keys.ENTER == e.keyCode) {
                                var pane = getPane($("#index").val());

                                if (!pane) return;

                                splitter.max(pane, $("#max").val());
                            }
                        };

                    $("#toggle").click( function (e) {
                        var pane = getPane($("#index").val());
                        if (!pane) return;

                        splitter.toggle(pane, $(pane).width() <= 0);
                    });

                    $("#setSize").click(setSize);
                    $("#size").keypress(setSize);

                    $("#setMinSize").click(setMinSize);
                    $("#min").keypress(setMinSize);

                    $("#setMaxSize").click(setMaxSize);
                    $("#max").keypress(setMaxSize);

                    var splitter = $("#splitter").kendoSplitter({
                        orientation: "horizontal",
                        panes: [
                            { collapsible: true, size: "100px" },
                            { collapsible: false, contentUrl: "../../content/web/splitter/ajax/ajaxContent1.html" },
                            { collapsible: true, size: "20%" }
                        ]
                    }).data("kendoSplitter");
                });
            </script>
            <style scoped>
                .configuration .options input
                {
                    width: 40px;
                }
            </style>
        </div>

</body>
</html>
